package org.tulkas.robot.extension;

import org.tulkas.config.BasicConfig;
import org.tulkas.robot.plugin.IPluginAware;

/**
 * @author <a href="mailto:tulkas.web@gmail.com">Tulkas</a>
 *
 */
public class ConfigExtension implements IExtension, IPluginAware {
	public static final String NAME_KEY = "name";
	public static final String DESCRIPTION_KEY = "description";
	private final BasicConfig props = new BasicConfig();
	private final String pluginName;

	public ConfigExtension(BasicConfig props) {
		this(props, null);
	}

	public ConfigExtension(BasicConfig props, String pluginName) {
		this.props.setValues(props);
		this.pluginName = pluginName;
	}

	/* (non-Javadoc)
	 * @see org.tulkas.robot.extension.IExtension#getDescription()
	 */
	public String getDescription() {
		return props.getString(DESCRIPTION_KEY);
	}

	/* (non-Javadoc)
	 * @see org.tulkas.robot.extension.IExtension#getName()
	 */
	public String getName() {
		return props.getString(NAME_KEY);
	}

	public String[] getParamNames() {
		return props.getAllKeys();
	}

	public String getParamValue(String name) {
		return props.getValue(name);
	}

	public String getPluginName() {
		return pluginName;
	}

}
